/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package net.tygzs.minerpg.CommandExecutor.MinePacket;

import net.tygzs.minerpg.Configuration.packet.Packet;
import net.tygzs.minerpg.Main;
import static org.bukkit.Bukkit.getServer;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;

/**
 *
 * @author thtTNT
 */
public class Command_Edit
{

    public static void openPacketEditer(CommandSender sender, String PacketName)
    {
        if (!Main.getPluginConfig().getPackets().containsKey(PacketName))
        {
            sender.sendMessage(ChatColor.RED + "礼包不存在");
            return;
        }
        Player player = (Player) sender;
        Inventory inv = getServer().createInventory(player, 36, "PacketEditer:" + PacketName);
        Packet packet = Main.getPluginConfig().getPackets().get(PacketName);
        for (ItemStack is : packet.getItems())
        {
            inv.addItem(is);
        }
        player.openInventory(inv);
    }
}
